<?php

use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Route;

function dump_var($expression, $die = false) {
    echo '<PRE>';
    var_export($expression);
    echo '</PRE>';
    if ($die) {
        die();
    }
}

function translate($key) {
    return Lang::get($key);
}

function config($key, $default = null) {
    return Config::get($key, $default);
}

function config_translate($key) {
    return translate(config($key));
}

function crub_route($prefix, $controller) {
    Route::resource($prefix, $controller);
    Route::get("$prefix/active", array('as' => config("probackend::config.sites.prefix") . ".$prefix.active", 'uses' => $controller . '@active'));
    Route::get("/api/$prefix", array('as' => config("probackend::config.sites.prefix") . ".$prefix.api", 'uses' => $controller . '@datatable'));
}
